import sys
import logging

LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
stdout_logger = logging.getLogger('stdout')
stdout_logger.setLevel(logging.DEBUG)
stderr_logger = logging.getLogger('stderr')
stderr_logger.setLevel(logging.ERROR)

formatter = logging.Formatter(LOG_FORMAT)

stdout_stream_handler = logging.StreamHandler(sys.stdout)
stdout_stream_handler.setFormatter(formatter)
stdout_stream_handler.setLevel(logging.DEBUG)
stdout_logger.addHandler(stdout_stream_handler)

stderr_stream_handler = logging.StreamHandler(sys.stderr)
stderr_stream_handler.setFormatter(formatter)
stderr_stream_handler.setLevel(logging.WARNING)
stderr_logger.addHandler(stderr_stream_handler)

def debug(msg):
    stdout_logger.debug(msg)

def info(msg):
    stdout_logger.info(msg)

def warning(msg):
    stdout_logger.warning(msg)

def error(msg):
    stderr_logger.error(msg)

def critical(msg):
    stderr_logger.critical(msg)
